#include <iostream>
#include <gtest/gtest.h>

/******************************
    断言测试
        ASSERT_ 断言失败立马退出
        EXPECT_ 断言失败继续执行
******************************/


int abs(int x)
{
    if (x < 0)
        return -x;
    return x;
}

TEST(test, eqest)
{
    ASSERT_EQ(1,abs(1));
}

TEST(test,eqests)
{
    int a=-10;
    EXPECT_EQ(a,abs(a));
    ASSERT_EQ(10,30);
    EXPECT_EQ(30,20)<<"30!=20"; //断言失败会打印
    EXPECT_EQ(10,10);
}


int main(int argc,char *argv[])
{
    testing::InitGoogleTest(&argc,argv);
    RUN_ALL_TESTS();
    return 0;
}